<template>
    <div class="mui-numbox" data-numbox-min='1' :data-numbox-max='item.count'>
			<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
			<input id="test" class="mui-input-numbox" type="number" :value="item.num"  ref="numbox" @change="updateNum(item.id)" />
			<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
		</div>
</template>

<script>
import mui from '../libs/mui/js/mui.js'

export default {
  props:["item"],
  mounted(){
    mui(".mui-numbox").numbox()
  },
  methods:{
    updateNum(id){
      console.log(this.$props.item.id)
      let obj={
        num:this.$refs.numbox.value,
        id
      }

      this.$store.commit("updateCarnum",obj)
    }
  }
}
</script>